<?php
class Controller_Ckeditor extends Controller_Abstract{
	
	function actionUpload(){
				
		$callback = $this->_context->CKEditorFuncNum;
		
		$helper = new Helper_Uploader_File($_FILES['upload'], 'cashout');
		if($helper->isValid('jpg, jpeg, png, gif', 2048 * 1024)){
			if($helper->move('/opt/lampp/htdocs/gameco/backend/pub/img/test.png')->isMoved())
				$message = 'Upload Success';
			else
				$message = 'Failed, try again';
		}
		else
			$message = 'Invlaid file type, or too large';
		dump($callback, 'callback_func');
		$fileurl = 'http://www.gameco.frontend/img/logo.png';
		$fn = $callback;
		dump($_FILES['upload']);
		$str = '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction('.$fn.', \''.$fileurl.'\', \''.$message.   
					'\');</script>';   
   		exit($str); 
	}
	
}